#include <iostream>
#include <sstream>
#include <vector>
#include <string>
using namespace std;

template<class T>
void Search_Pairs(const vector<T>& A, int sum)
{
	int jug = 0;
	for (int i = 0; i < A.size(); i++)
	{
		for (int j = i + 1; j < A.size(); j++)
		{
			if (A[i] + A[j] == sum)
			{
				if (jug) cout << ',';
				jug = 1;
				cout << '(' << A[i] << ',' << A[j] << ')';
			}
		}
	}
	if (!jug) cout << "NULL";
}

int main()
{
	vector<int> v;

	string str;
	getline(cin, str);
	stringstream s(str);

	int tmp;
	while (s >> tmp)
		v.push_back(tmp);

	int jug = 0;
	for (auto e : v)
	{
		if (jug) cout << ',';
		jug = 1;
		cout << e;
	}	cout << endl;
	cout << endl;
	
	int sum;
	cin >> sum;
	Search_Pairs(v, sum);

	return 0;
}